<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <img src="./imgs/1t.png" />
    </div>
    <script>
        var num = 1;
        var imgEle = document.querySelector("img");
        // 单纯的从第一张切换到第五张图；
        setInterval(function(){
            num++;
            console.log(num);
            imgEle.style.transition = "all 1s";
            imgEle.style.opacity = 0;
            imgEle.ontransitionend = function(){
                imgEle.src = `./imgs/${num}t.png`;
                imgEle.style.opacity = 1;
            }
            if(num==5){
                num = 1;
            }
        },3000)



    </script>
</body>
</html>